#include "copycat.h"

int main( int argc, char *argv[] )
{
	if( argc != 4 )	{
		fprintf( stderr, "usage: %s  src-parse  src-sp  tgt-sp\n", argv[0] );
		return 1;
	}

	CUTextFile parse_file( argv[1], "r" );
	if( parse_file.IsOpen() == false )	{
		fprintf( stderr, "ERROR: file open fail %s\n", argv[1] );
		return false;	
	}

	CUTextFile src_file( argv[2], "r" );
	CUTextFile tgt_file( argv[3], "r" );

	fprintf( stderr, "[Loading Word Align ]   " );

	int num_line = parse_file.GetNumLine(); parse_file.MoveToStart();
	int num_sent = 0;
	int num_src_tok = 0;
	int num_tgt_tok = 0;
	int num_src_node = 0;
	while(1)	{
		CUString line;
		if( parse_file.ReadLine( line ) == false )	break;
		line.Replace("\r", "" );

		CUString line2;
		if( src_file.ReadLine( line2 ) == false )	break;

		CUString line3;
		if( tgt_file.ReadLine( line3 ) == false )	break;

		CUStringListSN src_tok( line2, " " );
		num_src_tok += src_tok.GetSize();

		CUStringListSN tgt_tok( line3, " " );
		num_tgt_tok += tgt_tok.GetSize();

		CTree t;
		t.Init();
		if( t.LoadTree( line ) == false )	return 1;
		num_src_node += t.num_node;



		
		num_sent++;
	}
	fprintf( stderr, "%d sentences\n", num_sent );
	fprintf( stderr, "%d src node\n", num_src_node );
	fprintf( stderr, "%d src tok\n", num_src_tok );
	fprintf( stderr, "%d tgt tok\n", num_tgt_tok );

	

	return 0;
}

